<%@page import="com.baozun.model.TFindMail"%>
<%@page import="com.baozun.model.TUser"%>
<%@page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta charset="utf-8" />
<title>忘记密码界面</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template."/>
<meta name="author" content=""/>
<!-- basic styles -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="assets/css/font-awesome.min.css" />
<!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

<!-- page specific plugin styles -->

<!-- fonts -->

<link rel="stylesheet" href="assets/css/font.css" />

<!-- ace styles -->

<link rel="stylesheet" href="assets/css/ace.min.css" />
<link rel="stylesheet" href="assets/css/ace-rtl.min.css" />

<!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->

<!-- inline styles related to this page -->

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

<!--[if lt IE 9]>
		<script src="assets/js/html5shiv.js"></script>
		<script src="assets/js/respond.min.js"></script>
		<![endif]-->
<style>
 .find_message{
 	font-family:'微软雅黑';
 	font-size:12px;
 	font-weight:bold;
 }
 .alert-red{
 	color:red;
 }
.ser-signup-link .noline{
 	text-decoration:none;
 }
</style>
</head>
<%
String message = request.getParameter("message");
String stUsername = request.getParameter(TUser.ST_USERNAME);
String stEmail = request.getParameter(TUser.ST_EMAIL);
String stCheckCode = request.getParameter(TFindMail.ST_CHECK_CODE);
%>
<body class="login-layout">
	<div class="main-container">
		<div class="main-content">
			<div class="row">
				<div class="col-sm-10 col-sm-offset-1">
					<div class="login-container">
						<div class="center">
							<h1>
								<i class="icon-leaf green"></i> <span class="red">精品</span> <span
									class="white">网络应用</span>
							</h1>
							<h4 class="blue">&copy; 万世极缘网络工作室</h4>
						</div>

						<div class="space-6"></div>

						<div class="position-relative">
							<div id="forget-box" class="forget-box visible widget-box no-border">
								<div class="widget-body">
									<div class="widget-main">
										<h4 class="header red lighter bigger">
											<i class="icon-key"></i> 修改密码&nbsp;&nbsp;&nbsp;&nbsp;<font class="find_message alert-red" id="find_message"><%=message==null?"":message %></font>
										</h4>
										<div class="space-6"></div>
										<p>输入新密码</p>
										<form name="find_password_form" method="post" action="find_password_submit.do">
											<input type="hidden" value="<%=stUsername%>" name="<%=TUser.ST_USERNAME %>"/>
											<input type="hidden" value="<%=stEmail %>" name="<%=TUser.ST_EMAIL %>"/>
											<input type="hidden" value="<%=stCheckCode %>" name="<%=TFindMail.ST_CHECK_CODE %>"/>
											<fieldset>
												<label class="block clearfix"> <span
													class="block input-icon input-icon-right"> <input id="stPassword" name="<%=TUser.ST_PASSWORD %>"
														type="password" class="form-control" placeholder="新密码" onkeydown="enterJump(event,'confirmPassword')"/>
														<i class="icon-lock"></i>
												</span>
												</label>
												<label class="block clearfix"> <span
													class="block input-icon input-icon-right"> <input id="confirmPassword" name="confirmPassword"
														type="password" class="form-control" placeholder="确认密码" onkeydown="enterJump(event,'find_message')"/>
														<i class="icon-lock"></i>
												</span>
												</label>
												<div class="clearfix">
													<button type="button" onclick="updatePassword()"
														class="width-35 pull-right btn btn-sm btn-danger">
														<i class="icon-lightbulb"></i>修改提交
													</button>
												</div>
											</fieldset>
										</form>
									</div>
									<div class="toolbar center">
										<a style="cursor: pointer;" onclick="javascript:window.location='login.jsp'"
											class="back-to-login-link"> 返回登录 <i
											class="icon-arrow-right"></i>
										</a>
									</div>
								</div>
								<!-- /widget-body -->
							</div>
							<!-- /forgot-box -->
						</div>
						<!-- /position-relative -->
					</div>
				</div>
				<!-- /.col -->
			</div>
			<!-- /.row -->
		</div>
	</div>
	<!-- /.main-container -->

	<!-- basic scripts -->

	<!--[if !IE]> -->

	<!-- <![endif]-->

	<!--[if IE]>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<![endif]-->

	<!--[if !IE]> -->
<script src='assets/js/jquery-2.0.3.min.js'></script>
<script src="assets/js/jquery.gritter.min.js"></script>
	<!-- <![endif]-->

	<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

	<script type="text/javascript">
		if ("ontouchend" in document)
			document
					.write("<script src='assets/js/jquery.mobile.custom.min.js'>"
							+ "<"+"/script>");
	</script>

	<!-- inline scripts related to this page -->

	<script type="text/javascript">
	var canRegiste = false;
		function show_box(id) {
			jQuery('.widget-box.visible').removeClass('visible');
			jQuery('#' + id).addClass('visible');
		}
		function showbox(id){
			show_box(id); return false;
		}
	</script>
	<script type="text/javascript">
	//检查是否为空，如果为空返回假，有值返回真,提示信息为message
	function checkEmpty(id,message_id,message){
		var value = $("#"+id).val();
		if(value == null || "" == value){
			$("#"+message_id).html(message);
			canRegiste = false;
			return false;
		}else{
			canRegiste = true;
			return true;
		}
	}
	
	//确认密码校验
	function confirmPassword(){
		var stPassword = $("#stPassword").val();
		var confirmPassword = $("#confirmPassword").val();
		if(confirmPassword != stPassword){
			$("#find_message").html("确认密码不一致");
			return false;
		}else{
			return true;
		}
	}
	
	//更新密码
	function updatePassword(){
		if(checkEmpty("stPassword","find_message","密码不能为空")
				&&checkEmpty("confirmPassword","find_message","确认密码不能为空")
				&&confirmPassword()){
			document.find_password_form.submit();
		}
	}
	
	//按下enter键后跳到下一个输入框,输入完成后提交,如果得到的id是form，那么该form进行提交
	function enterJump(event,id){
		//如果是按下回车键
		if(event.keyCode == 13){
			//先判断id得到的是输入框还是form
			var obj = $("#"+id);
			var tagName = obj.prop("tagName");//注意这里不能使用attr，使用attr将会是undifined
			var name = obj.prop("name");
			if(tagName == "INPUT"){
				obj.focus();//输入框进入该输入框
			}else{
				if(name.indexOf("find")>-1){
					//登录提交
					loginCheck();
				}
			}
		}
	}
</script>
</body>
</html>

